<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>代理注册</title>
		<link rel="stylesheet" type="text/css" href="../ext/ext-all.css" />
		<script type="text/javascript" src="../ext/ext-base.js"></script>
		<script type="text/javascript" src="../ext/ext-all.js"></script>
<script type="text/javascript">
Ext.BLANK_IMAGE_URL = '../images/s.gif';
</script>

	<script type="text/javascript">
	Ext.onReady(function(){
		Ext.QuickTips.init();

		var proxystore1 = new Ext.data.Store({
        proxy: new Ext.data.HttpProxy({url: '../ajaxjsp/proxycombox.jsp?channel=channel'}),
        reader: new Ext.data.JsonReader({
        totalProperty: 'totalCount',
        root: 'result',
        fields :[{name:'clazzname'},{name:'showname'}]
        }),
        remoteSort: true
        });

        var belongProxy = new Ext.form.ComboBox({
		         store: proxystore1,
		         //width:50,
		         readOnly:true,
		         //emptyText: '10',
		         mode: 'remote',
		         triggerAction: 'all',
		         valueField: 'clazzname',
		         displayField: 'showname',
		         //minListWidth : '40%',
		         fieldLabel: '通道总服务器',
		         hiddenName : 'hclassname',
                 name: 'hclassname_',
                 id:'hclassname_',
		         pageSize : 5
		     });

	    var simple = new Ext.FormPanel({
	    renderTo:'myf',
        labelWidth: 140, // label settings here cascade unless overridden
        url:'../ajaxjsp/channelregdit.jsp',
        frame:true,
        title: '通道注册',
        bodyStyle:'padding:5px 5px 0',
        width: 600,
        defaults: {width: 230},
        defaultType: 'textfield',

        items: [
               belongProxy,
               {
                fieldLabel: '通道自定义名',
                name: 'hname',
                allowBlank:false,
                blankText :'通道名必须填写'
            },{
                fieldLabel: '通道IP或服务地址',
                name: 'hip',
                labelWidth:150,
                vtypeText:'用户名只能包括字母或者数字'
            },{
                fieldLabel: '通道端口',
                name: 'hport',
                xtype:'numberfield'
            },
            {
                fieldLabel: '通道登录名',
                name: 'huname'

            },
            {
                fieldLabel: '通道密码',
                name: 'hpwd',
                //inputType : 'password',
                vtypeText:'密码只能包括字母或者数字',
                allowBlank:false

            },
             {
                fieldLabel: '重复通道密码',
                name: 'repwd',
                //inputType : 'password',
                vtypeText:'密码只能包括字母或者数字',
                allowBlank:false
            },{
                fieldLabel: '余额少于多少提醒',
                name: 'hcondition',
                xtype:'numberfield',
                vtypeText:'该值必须填写',
                allowBlank:false
            },
            {
                fieldLabel: '备注说明',
                name: 'hnote'
            }
        ],

        buttons: [{
            text: '注册',
            handler : function(){simple.form.submit({
					waitMsg : '正在处理......',
					success : function(form, action) {
            	        form.reset();
            	        proxystore1.reload();
						Ext.Msg.alert('成功',action.result.msg);
					},
					failure : function(form, action) {
						//form.reset();
						if (action.failureType == Ext.form.Action.SERVER_INVALID){
							Ext.MessageBox.alert('错误',action.result.errors.msg);
							}else{
							Ext.MessageBox.alert('错误','非法输入');
							}
					}
				});
            }
        },{
            text: '重填',
            handler : function(){
          		simple.form.reset();
            }
        }]
    });

    //simple.render(document.body);
    });
	</script>

  </head>

  <body bgcolor="#ffffff">
 <br>
     <div id="myf" align="center"></div>
  </body>
</html>
